#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:

    int getDis(vector<int>& A, int n) {
        int minn = A[0], ret = 0;
        vector<int> dp(n);
        for (int i = 0; i < n; i++)
        {
            minn = min(minn, A[i]);
            dp[i] = A[i] - minn;
            ret = max(ret, dp[i]);
        }
        return ret;
    }
};